package com.example.jl.bethinner.base;

import android.app.Application;
import android.content.Context;

import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.bugtags.library.Bugtags;
import com.example.jl.bethinner.util.MyLocationListener;

/**
 * Created by JL on 7/20/15.
 */
public class BtApplication extends Application {
    public static boolean showToast = false;
    public LocationClient mLocationClient = null;
    public BDLocationListener myListener = new MyLocationListener();
    private static BtApplication mApplication = null;
    public static Context applicationContext;
    /**
     * getInstance:单例方法，获取App的应用对象. <br/>
     * 只有在manifest文件中使用了该自定义的Application才能使用改单例方法.<br/>
     *
     * @author BaoHang
     * @return mApplication 返回App应用对象
     */
    public static BtApplication getInstance() {
        if (mApplication == null) {
            mApplication = new BtApplication();
        }
        return mApplication;
    }
    @Override
    public void onCreate() {
        super.onCreate();
        BtApplication.applicationContext = getApplicationContext();
        //在这里初始化
        Bugtags.start("78e6df5497092a510f7259a2e356aa5b", this, Bugtags.BTGInvocationEventBubble);

        mLocationClient = new LocationClient(getApplicationContext());     //声明LocationClient类
        mLocationClient.registerLocationListener(myListener);    //注册监听函数
    }

}
